package com.amos.muexamclient.sys.controller;

import com.amos.bean.Result;
import com.amos.muexamclient.sys.service.SysDictDataService;
import com.amos.muexamclient.sys.service.dto.SysDictDataDTO;
import com.amos.muexamcore.core.BasePageController;
import com.amos.muexamcore.core.BasePageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Copyright © 2018 五月工作室. All rights reserved.
 *
 * @Package com.amos.muexamclient.sys.controller
 * @ClassName SysDictDataController
 * @Description TODO
 * @Author Amos
 * @Modifier
 * @Date 2020-03-24 14:33:46
 * @Version 1.0
 **/
@RestController
@RequestMapping(value = "/sys/dict-data")
public class SysDictDataController extends BasePageController<SysDictDataDTO> {
    @Autowired
    private SysDictDataService sysDictDataService;

    @Override
    public BasePageService<SysDictDataDTO> getPageService() {
        return sysDictDataService;
    }

    /**
     * 根据字典类型查询字典数据信息
     *
     * @param dictType
     * @return
     */
    @GetMapping(value = "/dict-type/{dictType}")
    public Result getByDictType(@PathVariable("dictType") String dictType) {
        return Result.success(this.sysDictDataService.getByDictType(dictType));
    }
}
